package com.chd.driversystem.util.tools;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.chd.driversystem.domain.User;
import com.chd.driversystem.gen.BeanServer;
import com.chd.driversystem.util.network.bean.TokenManager;

/**
 * Created by feiyu on 17-5-8.
 */

public class MyApplication extends Application {
    private static Context context;
    private static User user;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        SharedPreferences pf = PreferenceManager.getDefaultSharedPreferences(context);
        TokenManager.setToken(pf.getString("ticket",""));

        BeanServer.getInstance();
    }

    public static Context getContext() {
        return context;
    }

    public static User getUser() {
        return user;
    }

    public static void setUser(User user) {
        MyApplication.user = user;
    }
}
